package fun.gudu.modules.controller;

import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import fun.gudu.modules.entity.Message;
import fun.gudu.modules.service.IMessageService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.sql.Timestamp;
import java.util.List;

/**
 * 数据报文表
 *
 * @author WuYuXin
 * @since 1.0.0 2025-06-03
 */
@Slf4j
@RestController
@RequestMapping(value = "/message")
public class MessageController {
    @Autowired
    private IMessageService messageService;

    @GetMapping("query")
    public List<Message> query() {
        LambdaQueryWrapper<Message> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.le(Message::getTs, "2025-06-18 19:40:41");
        queryWrapper.last("limit 3");
        return messageService.list(queryWrapper);
    }
}